Page 97 - 2629_Devagiri_C-8
P. 97
3. A while loop checks the condition after each repetition.
4. After a break statement is executed, control moves to the beginning of the loop again.
5. The continue statement is used to skip the current iteration of the loop and move
to the next one.
D. Answer the following questions:
1. Write the syntax of the following:
(a) for loop (b) while loop
2. Explain the difference between a for loop and a while loop.
3. Write a Python program to print the numbers in reverse order from 5 to 1.
4. Describe an infinite loop.
21 st
COMPETENCY-BASED QUESTIONS Century #Critical Thinking
Skills #Technology Literacy
1. A computer teacher asks students to enter numbers continuously. The program should keep accepting
numbers and calculating their total. However, if the student enters a negative number, the program
must stop immediately and display the total of all positive numbers entered so far. Which statement
will immediately stop the loop when a negative number is entered?
2. Amit is using a for loop to print the first 6 even numbers. Which range should he use
to print them?
95
Networks Around Us

